home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMIBEST4.ADF / WorkbenchStuff / IconExec.DOC < prev    next >
Text File  |  1987-07-22  |  6KB  |  121 lines

  1.  
  2. /* (c) Copyright 1986 John A. Toebes, VIII   All rights reserved         */
  3. /*     120-H Northington Place,   Cary NC 27511   (919) 469-4210         */
  4. /*  This program may be used and modified for any purpose so long as     */
  5. /*  this copyright notice remains with the code and the program is not   */
  6. /*  sold and no charge is made for its use.                              */
  7. Date-Received: 22 Feb 86 06:37:26 GMT
  8. Sender: jcz@ncsu.UUCP
  9. Organization: SAS Institute Inc.
  10.  
  11.  
  12. Here are two simple utilities that may make it easier to write code that
  13. runs from workbench.  The second utility IconExec allows you to run any
  14. arbitrary command from an Icon WITHOUT having to recompile a program
  15. everytime you wish to change what is run.  The other utility allows you to
  16. set the default window that will be used when an Icon is selected.
  17.  
  18. As a matter of short explaination, whenever an Icon is selected, the
  19. ToolWindow field is (supposed to be) copied into the initial startup
  20. message that is passed to your program.  The startup code (c.o) looks at
  21. that message and opens up that window by default.  In this way you can
  22. always associate a window with a program without having to open it in your
  23. code.  Unfortunately, Intuition (or whomever is responsible) fails to copy
  24. the ToolWindow field over and no window is opened currently.  ICONEXEC
  25. takes that into account and opens up the window anyway (Until the parameter
  26. gets copied correctly in a later OS release) and sets it as the default
  27. window.
  28.  
  29. Once a window is established, the commands that are contained in the
  30. ToolTypes arrays are then executed one at a time.  More detailed
  31. information about how the Icons are organizied is in Chapter 4 of Volume1
  32. in the 1.1 Rom Kernal Manual, although the information is not critical to
  33. using the program.  If enough interest exists, I will create a tutorial on
  34. using Icons or whatever other information is desired in creating/accessing
  35. them from a program.
  36.  
  37. These programs were created in response to a request for being able to run
  38. programs such as MUSICRAFT which have no ICONS without Having to modify the
  39. program.  If you plan on using ICONEXEC for a commercial product, just
  40. contact me first.
  41.  
  42.  
  43. AltIcon 
  44.  
  45. In making some enhancements to the Icons for Hack, I wrote a very simple
  46. utility that you may find useful.  Normally, the Icon editor only lets you
  47. create icons whose selected action is either to reverse the image or
  48. provide backfill.However, in the gadget structure for the Icon is the
  49. ability to put an alternate image as found in any gadget.  To use it you
  50. simply have to supply an alternate image and set the appropriate bits in
  51. the structure.
  52.  
  53. Unfortunately ICONED fails to provide an easy way to do this so I wrote a
  54. Q&D tool to combine two icons into a single one with the second being an
  55. alternate image for the first.
  56.  
  57. To use it, first compile the program (It works under Lattice, have no idea
  58. about MANX) and link it.
  59.  
  60. Then create two icons for the one you want.  Make the first the normal
  61. image and the second the alternate image.  When saving them make sure you
  62. set the frame the same for both or the results will be an alternate image
  63. slightly out of wack (and I don't mean the debugger) with the first.  Lets
  64. assume the first is called 'primary' and the second 'alternate'. At this
  65. point there will be four files on disk:
  66.  
  67.     primary
  68.     primary.info
  69.     secondary
  70.     secondary.info
  71.  
  72. Now run the SetAlternate (AltIcon) program with
  73.  
  74.    SetAlternate primary secondary
  75.  
  76. The primary icon will now display the second one when you hit on it.  Note
  77. that since the image was copied, you can delete the second one ('secondary'
  78. in this case) without any effect.  Note however that ICONED does not know
  79. exactly what to do with the alternate image so you lose it if you edit the
  80. Icon.  Have no fear, just run the program again to reset the alternate.
  81. Also there are no side effects from running SetAlternate over and over on
  82. the same icons (other than waste time).
  83.  
  84.  
  85. IconExec
  86.  
  87. /* ICONEXEC (c) Copyright 1986 John A. Toebes, VIII. All rights reserved */
  88. /*  This program may be used and modified for any purpose so long as     */
  89. /*  this copyright notice remains with the code and the program is not   */
  90. /*  sold and no charge is made for its use.  For permission to           */
  91. /*  incorporate this into a commercial product, contact the author:      */
  92. /*    John A. Toebes, VIII                                               */
  93. /*    120 H Northington Place                                            */
  94. /*    Cary NC 27511                                                      */
  95. /*    (919) 469-4210                                                     */
  96.  
  97.  
  98. This program allows you to associate any series of CLI commands to be run
  99. when you click on an ICON even though there is no CLI window open One
  100. problem associated with it is that a program that does input from the
  101. default input (*) always sees EOF.  I am researching why this happens, but
  102. believe it is related to an AmigaDos problem.  
  103.  
  104.    To create and execute a user customized Icon Exec
  105.  
  106.     1) Create an Icon (copy the CLI Icon) for IconExec
  107.  
  108.     2) Run the SetWindow program to set a the tool window on the Icon
  109.  
  110. SETWINDOW ICONEXEC "CON:0/0/100/100/MYWINDOW"
  111.  
  112.        If you do not do this, then by default ICONEXEC will open a full
  113.        screen window with a title of "ICONEXEC by John A. Toebes, VIII"
  114.  
  115.     3) Using the Workbench INFO meno option, enter the commands into the
  116.        tool types window.
  117.  
  118.     4) Click on the Icon and watch it go.
  119.     
  120. Subject: ICONEXEC utility
  121.